<%@ page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"  %>
<%@ include file="/user/load_user_with_redirect.jsp" %>
<%
	String reading = request.getParameter("reading");
	if (reading.equals("")){
		return;
	}
	String title = request.getParameter("title");
	String language = request.getParameter("language");
	String granularity = request.getParameter("granularity");
	String comments = request.getParameter("comments");
	boolean hasWordGranularity = org.languageguide.readings.FormReadingUtil.getGranularityValue(granularity);

	String source = request.getParameter("source");	
	Integer id = org.languageguide.readings.ReadingManager.addReading(reading, title, language, source, hasWordGranularity, comments, user);
	if (id != null){
		response.sendRedirect("/user/readings/reading_submit_preview.jsp?id=" + id);
	}
%>